using System;
using System.Text;
using System.Configuration;

using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;

namespace UMEVOR.DAL
{
    public class DALConnection
    {

        public static DbConnection conn;
        public static DbTransaction transaction;

        public static void beginTransaction()
        {
            Database database = DatabaseFactory.CreateDatabase("DATABASE");
            conn = database.CreateConnection();
            conn.Open();
            transaction = conn.BeginTransaction();
        }

        public static void commitTransaction()
        {
            transaction.Commit();
            conn.Close();
        }

        public static void rollbackTransaction()
        {
            transaction.Rollback();
            conn.Close();
        }

        protected Database getDatabase()
        {
            try
            {
                Database banco = DatabaseFactory.CreateDatabase("DATABASE");
                return banco;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

    }
}

